package kr.saeildamil.androidstudy.ch18;

import kr.saeildamil.androidstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class ApplicationTest extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch18_applicationtest);
		
		updateNowMode();
	}

	private void updateNowMode() {
		TextView tv = (TextView) findViewById(R.id.ch18_applicationtest_mod);
		AndroidStudyApplication app = (AndroidStudyApplication) getApplication();
		if(app.getmMode() == AndroidStudyApplication.BEGINNER){
			tv.setText("현재모드:초보자모드");	
		}else{
			tv.setText("현재모드:숙련자모드");
		}
	}
	
	public void mOnClick(View v){
		AndroidStudyApplication app = (AndroidStudyApplication) getApplication();
		switch(v.getId()){
		case R.id.ch18_application_biginner:
			app.setmMode(AndroidStudyApplication.BEGINNER);
			break;
		case R.id.ch18_application_professional:
			app.setmMode(AndroidStudyApplication.PROFESSIONAL);
			break;
		}
		updateNowMode();
	}
}
